import 'dart:math';
import 'package:find_friend/const/const.dart';
import 'package:flutter/material.dart';


class RiseAnimatedWidget extends StatelessWidget {

  final bool iszan;
  final double imgW;
  final Animation<double> dissAnimation;
  final Animation<double> likeAnimation;
  final bool value;
  final BoxFit fit;

  RiseAnimatedWidget({
    Key key, 
    @required this.iszan, 
    @required this.imgW, 
    @required this.dissAnimation,
    @required this.likeAnimation,
    this.value,
    this.fit,
  }) : super(key: key);

  

  @override
  Widget build(BuildContext context) {
    return Transform.rotate(
      angle: iszan ? pi : 0,
      child: Stack(
        children: [
          Offstage(
            offstage: value == false,
            child: AnimatedBuilder(
              animation: dissAnimation,
              // child: Image.asset("assets/cai.png", width: imgW, height: imgH,fit: this.fit ?? BoxFit.fill),
              child: Icon(const IconData(0xe607, fontFamily: "iconfont"), size: imgW,),
              builder: (context, child){
                return Transform.scale(scale: value == false ? 1.0 : dissAnimation.value, child: child,);
              },
            ),
          ),
          AnimatedBuilder(
            animation: likeAnimation,
            child: value == false ? Icon(const IconData(0xe607, fontFamily: "iconfont"),size: imgW,) : Icon(const IconData(0xe60c, fontFamily: "iconfont"), color: APP_main_color,size: imgW,),
            builder: (context, child){
              return Transform.scale(scale: value == false ? 1.0 : likeAnimation.value, child: child,);
            },
          ),
        ],
      ),
    );
  }
}